#include <iostream>
#include <vector>
using namespace std;

int dfs(vector<vector<int>> &gh, int u, vector<int> &path)
{
        path.push_back(u);
        for(int v = 1; v < gh.size(); v++){
                if(gh[u][v] == 1){
                      gh[u][v] = gh[v][u] = 0;
                      dfs(gh, v, path);  
                }
        }
        return 0;
}

int main()
{
        int n, m;
        cin>>n>>m;
        vector<vector<int>> gh(n + 1, vector<int>(n + 1, 0));
        vector<int> deg(n + 1, 0);
        for(int i = 0; i < m; i++){
                int u, v;
                cin >> u >> v;
                gh[u][v] = gh[v][u] = 1;
                deg[u]++;
                deg[v]++;
        }
        int start = 1;
        for(int i = 1; i <= n; i++){
                if(deg[i]%2){
                        start = i;
                        break;
                }
        }
        vector<int> path;
        dfs(gh, start, path);
        for(auto u : path){
                cout << u << " ";
        }
        cout<<endl;
        return 0;
}